<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
          <script type="text/javascript" src="js/jquery.min.js" ></script>
      	  <script type="text/javascript" src="js/jquery.cookie.js"></script>
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row" id="saveTr">
                <form class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>问答标签
                      </label>
                    <div class="layui-input-inline">
                       	<textarea id="title" rows=10 cols=50> </textarea>
                      </div>
                     
                  </div>
                  <div class="layui-form-item">
                      <label for="phone" class="layui-form-label">
                          <span class="x-red">*</span>问答内容
                      </label>
                      <div class="layui-input-inline">
                      	<textarea id="content" rows=30 cols=150> </textarea>
                       <!--   <input type="text" id="content" name="phone" required="" lay-verify="phone"
                          autocomplete="off" class="layui-input">-->
                      </div>
                      
                  </div>
               
                  
                 
               
                   
                
                   
                <div class="layui-form-item">
                		 
                		 
                		 <!--	<button class="layui-btn" id="empty" type="button" lay-filter="sreach">
										<i class="layui-icon">清空</i>
									</button>-->
            <label for="L_repass" class="layui-form-label"></label>
              <button class="layui-btn" href="javascript:;" lay-filter="sreach" id="btn2">
          	<i class="layui-icon"></i>提交</button>
          <button class="layui-btn-danger layui-btn layui-btn-xs" href="javascript:;"  id="btn">
          	<i class="layui-icon"></i>退出</button>
  
        </div>
        
        <div class="layui-form-item">
					
              </form>
            </div>
        </div>
        <script type="text/javascript"></script>
  <script src="js/axios.min.js"></script>
  	<script type="text/javascript" src="js/vue.js"></script>
  <script type="text/javascript" src="js/jquery.min.js" ></script>
  <script type="text/javascript" src="js/jquery.cookie.js"></script>
        <script>
        	
        	layui.use(['form', 'layer'],
            function() {
            var id=$.cookie("id"); 
          	$.ajax({
					type:"get",
					url:"http://localhost:9095/admin/eduq/getid",
					async:true,
					data:{
						"id": id
					},
					headers: {
						"token2": $.cookie("token2")
					},
					success:function(msg){
					 var title=msg.data.title;
            	    var content=msg.data.content;
                	$("#title").val(title);
                	$("#content").val(content);
                	
					}
				});
   });
        
        </script>
        
        <script>         
            $(function(){
            	 $("#btn").click(function(){
            	//parent.location.reload();
            	   var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
            }) 	
            
            
            $("#btn2").click(function(){
            	     var id=$.cookie("id"); 
					var title = $("#title").val();
					var  content = $("#content").val();
			 
				 
					var params = {
						"title": title,
						"content": content,
						"id":id
					 
					}
				 	$.ajax({
						type: "post",
						url: "http://localhost:9095/admin/eduq/update",
						data: params,
						headers: {
						"token2": $.cookie("token2")
					},
						dataType: 'json',
						success: function() {
							alert("请求成功");
							  var index = parent.layer.getFrameIndex(window.name);
                             //关闭当前frame
                             parent.layer.close(index);
						},
						error: function(result) {
							alert("error");
						}
					}) 
            	
            	
            })
            })
        </script>
    </body>

</html>
